// This file was created by Filewrap 1.1
// Little endian mode
// DO NOT EDIT

#include "../PVRTMemoryFileSystem.h"

// using 32 bit to guarantee alignment.
#ifndef A32BIT
 #define A32BIT static const unsigned int
#endif

// ******** Start: envmap.pfx ********

// File data
static const char _envmap_pfx[] = 
	"[HEADER]\r\n"
	"\tVERSION\t\t00.00.00.00\r\n"
	"\tDESCRIPTION Environment Map Example\r\n"
	"\tCOPYRIGHT\tImagination Technologies Ltd.\r\n"
	"[/HEADER]\r\n"
	"\r\n"
	"[TEXTURES]\r\n"
	"\tFILE base \t\t\tbase.pvr\t\t\tLINEAR-LINEAR-LINEAR\r\n"
	"\tFILE reflection \treflection.pvr\t\tLINEAR-LINEAR-LINEAR\r\n"
	"[/TEXTURES]\r\n"
	"\r\n"
	"[VERTEXSHADER]\r\n"
	"\tNAME myVertShader\r\n"
	"\t[GLSL_CODE]\r\n"
	"\t\tattribute highp vec4\tmyVertex;\r\n"
	"\t\tattribute mediump vec3\tmyNormal;\r\n"
	"\t\tattribute mediump vec4\tmyUV;\r\n"
	"\t\tuniform mediump mat4\tmyMVPMatrix;\r\n"
	"\t\tuniform mediump mat3\tmyModelViewIT;\r\n"
	"\r\n"
	"\t\tmediump vec3  Normal;\r\n"
	"\t\tmediump vec3  EyeDir;\r\n"
	"\t\t\r\n"
	"\t\tvarying mediump float LightIntensity;\r\n"
	"\t\tvarying mediump vec2  texCoord;\r\n"
	"\t\tvarying mediump vec2  ReflectTexCoord;\r\n"
	"\r\n"
	"\t\tconst mediump vec3  LightPos = vec3(1,1,1);\r\n"
	"\t\tconst mediump vec3 Xunitvec = vec3 (1.0, 0.0, 0.0);\r\n"
	"\t\tconst mediump vec3 Yunitvec = vec3 (0.0, 1.0, 0.0);\r\n"
	"\r\n"
	"\t\tvoid main(void) \r\n"
	"\t\t{\r\n"
	"\t\t\t// Transform Position\r\n"
	"\t\t\tgl_Position = myMVPMatrix * myVertex;\r\n"
	"\t\t\t\r\n"
	"\t\t\t// Transform Normal\r\n"
	"\t\t\tNormal = myModelViewIT * myNormal;\r\n"
	"\t\t\t\t\r\n"
	"\t\t\t// Calculate diffuse lighting\r\n"
	"\t\t\tEyeDir         = vec3(gl_Position);\r\n"
	"\t\t\tLightIntensity = abs(dot(normalize(LightPos - EyeDir), Normal))*0.5+0.5;\r\n"
	"\t\t\t\r\n"
	"\t\t\t// Passtrough UVs\r\n"
	"\t\t\ttexCoord = myUV.st;\r\n"
	"\t\t\t\r\n"
	"\t\t\t// Compute reflection vector   \r\n"
	"\t\t\tmediump vec3 reflectDir = normalize(reflect(EyeDir, Normal));\r\n"
	"\r\n"
	"\t\t\t// Compute altitude and azimuth angles\r\n"
	"\t\t\tReflectTexCoord.y = dot(reflectDir, Yunitvec);\r\n"
	"\t\t\tReflectTexCoord.x = dot(reflectDir, Xunitvec);\r\n"
	"\r\n"
	"\t\t\tReflectTexCoord = (ReflectTexCoord + 1.0) * 0.5;\r\n"
	"\r\n"
	"\t\t}\r\n"
	"\t[/GLSL_CODE]\r\n"
	"[/VERTEXSHADER]\r\n"
	"\r\n"
	"[FRAGMENTSHADER]\r\n"
	"\tNAME myFragShader\r\n"
	"\t[GLSL_CODE]\r\n"
	"\r\n"
	"\r\n"
	"\t\tconst mediump vec3  BaseColor = vec3(0.5, 1.0, 0.8);\r\n"
	"\t\tconst mediump float MixRatio = 0.6;\r\n"
	"\r\n"
	"\t\tuniform sampler2D sampler2d;\r\n"
	"\t\tuniform sampler2D reflect2d;\r\n"
	"\r\n"
	"\t\tvarying mediump float LightIntensity;\r\n"
	"\t\tvarying mediump vec2  texCoord;\r\n"
	"\t\tvarying mediump vec2  ReflectTexCoord;\r\n"
	"\r\n"
	"\t\tvoid main (void)\r\n"
	"\t\t{\r\n"
	"\r\n"
	"\t\t\t// Draw the static base    \r\n"
	"\t\t\tmediump vec3 envColor  = vec3 (texture2D(sampler2d, texCoord));\r\n"
	"\t\t    \r\n"
	"\t\t\t// Do a lookup into the environment map.\r\n"
	"\t\t\tmediump vec3 envColor2 = vec3 (texture2D(reflect2d, ReflectTexCoord));\r\n"
	"\t\t\t\r\n"
	"\t\t\t// Mix them\r\n"
	"\t\t\tenvColor = mix(envColor, envColor2, MixRatio);\r\n"
	"\r\n"
	"\t\t\t// Add lighting to base color and mix\r\n"
	"\t\t\tmediump vec3 base = LightIntensity * BaseColor;\r\n"
	"\t\t\tenvColor = mix(envColor, base, MixRatio);\r\n"
	"\r\n"
	"\t\t\tgl_FragColor = vec4 (envColor, 1.0);\r\n"
	"\t\t}\r\n"
	"\t[/GLSL_CODE]\r\n"
	"[/FRAGMENTSHADER]\r\n"
	"\r\n"
	"[EFFECT]\r\n"
	"\tNAME myEffect\r\n"
	"\r\n"
	"\tATTRIBUTE\tmyVertex\t\t\tPOSITION\r\n"
	"\tATTRIBUTE\tmyNormal\t\t\tNORMAL\r\n"
	"\tATTRIBUTE\tmyUV\t\t\t\tUV\r\n"
	"\tUNIFORM\t\tmyMVPMatrix\t\t\tWORLDVIEWPROJECTION\r\n"
	"\tUNIFORM\t\tmyModelViewIT\t\tWORLDVIEWIT\r\n"
	"\tUNIFORM\t\tsampler2d\t\t\tTEXTURE0\r\n"
	"\tUNIFORM\t\treflect2d\t\t\tTEXTURE1\r\n"
	"\r\n"
	"\tTEXTURE 0 base\r\n"
	"\tTEXTURE 1 reflection\r\n"
	"\r\n"
	"\tVERTEXSHADER myVertShader\r\n"
	"\tFRAGMENTSHADER myFragShader\r\n"
	"[/EFFECT]\r\n";

// Register envmap.pfx in memory file system at application startup time
static CPVRTMemoryFileSystem RegisterFile_envmap_pfx("envmap.pfx", _envmap_pfx, 2803);

// ******** End: envmap.pfx ********

